﻿using mytreeview;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class index : System.Web.UI.Page
    {
        public static TreeNode StaTreeNode = new TreeNode();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                // this.SessionDataSource1.SessionKey = this.SetSessionData();
            }
        }

       



       

        

        protected void PostBackFromClientControl1_Click(object sender, EventArgs e)
        {
            //  string toe = (e as SearchEventArgs).SearchValue.ToString();
            ;
        }



        protected void Treecnt1_TextChanged1(object sender, EventArgs e)
        {
            this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Prompt",
                "<script language='javascript' >alert('oe');</script>");
        }

        protected void TreeViewc1_copynode(object sender, EventArgs e)
        {
            StaTreeNode = new TreeNode((e as nodeEventArgs).MyNode.Text, (e as nodeEventArgs).MyNode.Value);
            //  StaTreeNode.ChildNodes.Clear();
            // ViewState["tno"] = (e as nodeEventArgs).MyNode;
            string s = (e as nodeEventArgs).MyNode.Value.ToString();
            string b = s;
            /*  this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Prompt",
                "<script language='javascript' >alert('"+b+"');</script>");*/
        }

        protected void TreeViewc1_SelectedNodeChanged(object sender, EventArgs e)
        {
            TreeView n = sender as TreeView;
            string sd = n.Nodes.Count.ToString();
            //  int a = 0;
        }

        protected void TreeViewc1_pastenode(object sender, EventArgs e)
        {
            TreeNode tyh = (e as nodeEventArgs).MyNode;
            tyh.ChildNodes.Add(StaTreeNode);
            string s = (e as nodeEventArgs).MyNode.Value.ToString();
            string b = s;
            /* this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Prompt",
               "<script language='javascript' >alert('" + b + "');</script>");*/
        }

        protected void TreeViewc1_cutnode(object sender, EventArgs e)
        {
            StaTreeNode = (e as nodeEventArgs).MyNode;
            StaTreeNode.Parent.ChildNodes.Remove(StaTreeNode);
        }

        protected void TreeViewc1_deleteenode(object sender, EventArgs e)
        {
            (e as nodeEventArgs).MyNode.Parent.ChildNodes.Remove((e as nodeEventArgs).MyNode);
        }


        // int a = 0;

    }
}